﻿<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>流量充值</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<script src="Index.js"></script>
<script src="jquery.min.js"></script>
<script src="jquery.mobile-1.4.5.js"></script>
<script src="jquery.mobile-1.4.5.min.js"></script>
<script src="weiliuScript.js"></script>
<link rel="stylesheet" type="text/css"
	href="jquery.mobile-1.4.5.min.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
	<div>充值成功</div>
	<a href="index.html">返回</a>
</body>

<script type="text/javascript">

document.addEventListener('WeixinJSBridgeReady',
        function onBridgeReady() {
            $(".ui-loader").hide();
        }, false);
        
	function parseQueryString(url) {
		var reg_url = /^[^\?]+\?([\w\W]+)$/, reg_para = /([^&=]+)=([\w\W]*?)(&|$|#)/g, arr_url = reg_url
				.exec(url), ret = {};
		if (arr_url && arr_url[1]) {
			var str_para = arr_url[1], result;
			while ((result = reg_para.exec(str_para)) != null) {
				ret[result[1]] = result[2];
			}
		}
		return ret;
	}
	window.onload = function(){
		var data = parseQueryString( window.location.href);
		WeixinJSBridge.invoke('getBrandWCPayRequest', {
			"appId" : data.appId, //公众号名称，由商户传入
			"timeStamp" : data.timeStamp, //时间戳
			"nonceStr" : data.nonceStr, //随机串
			"package" : data.package,//扩展包
			"signType" : "MD5", //微信签名方式:MD5
			"paySign" : data.paySign
		//微信签名
		}, function(res) {
			clearDivChargeColor();
			callBack(res.err_msg, data);
			changging = false;
			isEnable = false;
			WeixinJSBridge.log(res.err_msg);
			var msg = res.err_msg;
			var arr = msg.split(':');

			if (arr && arr.length > 1 && arr[1] == 'ok') {
				alert("付款成功");
			}
			window.location.href = url;
		});
	}
</script>
</html>
